package com.minimalist.common.feign.client.tc;

import com.minimalist.common.config.mybatis.bo.PageResp;
import com.minimalist.common.entity.tc.entity.vo.order.TcOrderQueryVO;
import com.minimalist.common.entity.tc.entity.vo.order.TcOrderVO;
import com.minimalist.common.feign.config.BaseFeignClientFallback;
import com.minimalist.common.response.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * 车牌交易订单 Feign 客户端降级实现
 *
 * @author minimalist
 */
@Component
public class TcOrderFeignClientFallback extends BaseFeignClientFallback implements TcOrderFeignClient {

    private static final Logger log = LoggerFactory.getLogger(TcOrderFeignClientFallback.class);

    @Override
    public R<?> addOrder(TcOrderVO orderVO) {
        logServiceUnavailable("创建订单", orderVO);
        return R.fail(HttpStatus.SERVICE_UNAVAILABLE.value(), "服务不可用");
    }

    @Override
    public R<?> updateOrder(TcOrderVO orderVO) {
        logServiceUnavailable("更新订单", orderVO);
        return R.fail(HttpStatus.SERVICE_UNAVAILABLE.value(), "服务不可用");
    }

    @Override
    public R<TcOrderVO> getOrder(Long orderId) {
        logServiceUnavailable("获取订单详情", orderId);
        return R.fail(HttpStatus.SERVICE_UNAVAILABLE.value(), "服务不可用");
    }

    @Override
    public R<Map<String, Object>> importExcel(MultipartFile file) {
        logServiceUnavailable("导入订单", file != null ? file.getOriginalFilename() : "null");
        return R.fail(HttpStatus.SERVICE_UNAVAILABLE.value(), "服务不可用");
    }

    @Override
    public R<PageResp<TcOrderVO>> getPageOrderList(TcOrderQueryVO queryVO) {
        logServiceUnavailable("分页查询订单列表", queryVO);
        return R.fail(HttpStatus.SERVICE_UNAVAILABLE.value(), "服务不可用");
    }
}